package com.cj.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

@SuppressWarnings("serial")
public class SalaryRecord extends Model<SalaryRecord> {
	public static final SalaryRecord me = new SalaryRecord();
	
    public List<SalaryRecord> getAllSalaryRecords() {
		String sql = "select * from salaryrecord s left join employee e on s.empId = e.empId";
		return find(sql);
	}
    
    public List<SalaryRecord> getSalaryRecordsByEmployee(Integer empId) {
		String sql = "select * from salaryrecord s left join employee e on s.empId = e.empId where e.empId = ?";
		return find(sql, empId);
	}
    
    public SalaryRecord getSalaryRecordByEmpAndTime(String time, Integer empId) {
    	String sql = "select * from salaryrecord where recordTime = ? and empId = ?";
    	return findFirst(sql, time, empId);
    }
    
    public List<SalaryRecord> getSalaryRecordByTime(String time) {
    	String sql = "select * from salaryrecord s left join employee e on s.empId = e.empId where recordTime = ?";
    	return find(sql, time);
    }
    
}
